<?php
namespace Home\Controller;
use Think\Controller;
use Com\JSSDK;
use Common\Model;
class IndexController extends Controller {
    private  $appid="wx7a40b9a086f0bd81";
    private  $appSecret="d29d30a9709956940dd1c8146407ffaa";
    private  $WechatAuth="";//初始化WechatAuth类
    private  $accsess_token="";//缓存token
    public function index(){
        session("shopId",3);
        $result = D("UserInfo")->getQuestion();
        //dump($result);die();
        $this->assign("userData",$result);
        $this->display();
    }
    public function getWeixinToken(){
        $webUrl = I("get.url",null);
        $this->WechatAuth = new JSSDK($this->appid,$this->appSecret);
        $JSSDK = $this->WechatAuth;
        $signPackage = $JSSDK->getSignPackage($webUrl);
        $this->ajaxReturn($signPackage);
    }
    public function customInfo(){
        //print_r(__ROOT__);
        //print_r($_POST);die();
        $username = I("post.user_name",null);
        $mobile = I("post.user_mobile",null);
        if(is_null($username)) {
            return show(0,'用户名不存在');
        }
        if(is_null($mobile)) {
            return show(0,'用户手机号码不存在');
        }
        $upload = D("UserInfo");
        $userData = $_POST;
        $upload->customerData($userData);
    }
}